import axios from 'axios';

export default {
    install: function(Vue, options) {

        let service = {
            // 查询酒店订阅数量
            QueryHotelsCount: (condition) => {
                return axios.post('/hotel/query/count', condition);
            },

            // 查询酒店订阅列表
            QueryHotels: (condition, pageIndex, pageSize) => {
                return axios.post(`/hotel/query?pageIndex=${pageIndex}&pageSize=${pageSize}`, condition);
            },

            // 查询所有房型预定数量
            QueryQuantity: () => {
                return axios.get('/hotel/query/quantity');
            },

            // 导出比赛列表
            Export: (condition) => {
                return axios.post('/hotel/export', condition)
                    .then(ret => {
                        var link = aphf.file.ADDR + '/' + ret;

                        var a = document.createElement("a");
                        a.download = 'Hotels.xls';
                        a.href = link;
                        a.click();
                    })
            }
        }

        Vue.prototype.$HotelService = service;
    }
}